Skip to content

test: stfcEmailHandler function in a unit test - #1215

Merged
YufanKambang merged 3 commits into
developfrom
1439_adding_test_for_stfcEmailHandler
Nov 25, 2025
Merged

test: stfcEmailHandler function in a unit test#1215
YufanKambang merged 3 commits into
developfrom
1439_adding_test_for_stfcEmailHandler

Conversation

@YufanKambang

Copy link
Copy Markdown
Contributor

Description

this pr it to close this issue - UserOfficeProject/issue-tracker#1439

Motivation and Context

Motivation is to add more testing to our UOC, this specifically was a unit test for the: /user-office-core/apps/backend/src/eventHandlers/email/stfcEmailHandler.ts

How Has This Been Tested

This has been tested talking typescript with the tool jest.
jest - https://jestjs.io/docs/expect

within jest.unit.config.js, in the testRegex atribute, set the path to point to the specific test file:
/user-office-core/apps/backend/src/eventHandlers/email/stfcEmailHandler.ts

Then in the user-office-core directory, in the terminal npm run test

This can be viewed in:
/user-office-core/apps/backend/jest.unit.config.js

image

@YufanKambang
YufanKambang requested a review from a team as a code owner October 8, 2025 14:13
@YufanKambang
YufanKambang requested review from Scott-James-Hurley, TCMeldrum and mutambaraf and removed request for a team October 8, 2025 14:13

@Scott-James-Hurley Scott-James-Hurley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Each test group only has one test in it, which seems a bit excessive. Maybe the mailservice tests could be moved into the one group.

const mockMailService = {
sendMail: jest.fn(),
};
//we should have a test email inbocx to recieve all the email instead of skipping it, for e2e testing and for better pathways

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind writing an issue for this? If it's left as a code comment it may get forgotten about.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I learnt that we do have a inbox that fills this purpose, I think we can get rid of this comment

describe('mailService.sendMail is sucessful', () => {
it('When all required settings are valid', async () => {
// here instead of using a rng email, we instead set a magic variable for readability
// This test us

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't follow this comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems I didnt complete the comment, thank you for highlighting it

@YufanKambang

Copy link
Copy Markdown
Contributor Author

This looks great! Each test group only has one test in it, which seems a bit excessive. Maybe the mailservice tests could be moved into the one group.

Do you mean to say , to put all the it(...) into one describe(...)

@YufanKambang YufanKambang changed the title generated the unit test test stfcEmailHandler function in a unit test Oct 30, 2025
@YufanKambang YufanKambang changed the title test stfcEmailHandler function in a unit test test: stfcEmailHandler function in a unit test Oct 30, 2025
@YufanKambang YufanKambang self-assigned this Oct 30, 2025
@YufanKambang
YufanKambang requested review from a team and martin-trajanovski and removed request for a team October 30, 2025 13:36
@github-actions

github-actions Bot commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

⚠️ Automatic rebase failed due to conflicts. Please rebase manually.

1 similar comment
@github-actions

github-actions Bot commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

⚠️ Automatic rebase failed due to conflicts. Please rebase manually.

@github-actions
github-actions Bot force-pushed the 1439_adding_test_for_stfcEmailHandler branch 4 times, most recently from 2e34108 to 4c160cc Compare November 5, 2025 09:55
@mutambaraf
mutambaraf requested review from a team and jekabs-karklins and removed request for a team November 6, 2025 11:48
@github-actions
github-actions Bot force-pushed the 1439_adding_test_for_stfcEmailHandler branch from 4c160cc to 3cd0f76 Compare November 10, 2025 14:55
@github-actions
github-actions Bot force-pushed the 1439_adding_test_for_stfcEmailHandler branch from 3cd0f76 to 8b5d0ba Compare November 21, 2025 10:47
@YufanKambang
YufanKambang merged commit 9b3939e into develop Nov 25, 2025
22 checks passed
@YufanKambang
YufanKambang deleted the 1439_adding_test_for_stfcEmailHandler branch November 25, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants